package cn.qin.Services;
import net.sf.json.JSONArray;

import org.json.JSONException;

import cn.qin.DAO.newsOperateDAO;
import cn.qin.DAO.impl.newsOperateDAOimpl;
import cn.qin.Models.NEWS;
import cn.qin.Models.admin;

public class newsServices {
		newsOperateDAO newsoperatedao = new newsOperateDAOimpl();
	
	public newsOperateDAO getNewsoperatedao() {
		return newsoperatedao;
	}
	public void setNewsoperatedao(newsOperateDAO newsoperatedao) {
		this.newsoperatedao = newsoperatedao;
	}
	//存储新闻，被pubNewsAction调用
	public void saveNews(NEWS news){
		this.newsoperatedao.saveNews(news);
		System.out.println("newsServices:public void saveNews(NEWS news)");
		
	}
	//显示新闻，被showNewsAction调用
	public JSONArray showNews(NEWS news) throws JSONException{
		System.out.println("newsServices:public JSONArray showNews(NEWS news) throws JSONException");
		//System.out.println(newsoperatedao.showNews(news));
		return newsoperatedao.showNews(news);	
	}
	
	//删除新闻,参数id是前台传来的新闻的id
	public void delNews(int id){
		System.out.println("newsServices:public void delNews(int id)");
		this.newsoperatedao.delNews(id);

	}
	//登录功能
	public boolean login(admin admin){
		if(newsoperatedao.login(admin))
			return true;
		else 
			return false;
	}

}
